<template>
  <component :is="component" v-model="currentValue"></component>
</template>

<script>
export default {
  name: 'BResource',
  components: {
    Datasets: resolve => require(['@/components/storybook/b-resource/datasets.vue'], resolve),
    Dashboards: resolve => require(['@/components/storybook/b-resource/dashboards.vue'], resolve),
    Widgets: resolve => require(['@/components/storybook/b-resource/widgets.vue'], resolve),
    Bots: resolve => require(['@/components/storybook/b-resource/bots.vue'], resolve),
    Settings: resolve => require(['@/components/storybook/b-resource/settings.vue'], resolve)
  },
  props: {
    value: {
      type: Array,
      default: () => ([])
    },
    component: String
  },
  computed: {
    currentValue: {
      get () {
        return this.value
      },
      set (val) {
        this.$emit('input', val)
      }
    }
  }
}
</script>
